
import { DTaroAjax } from '@/http/http'
import http from '@/api/'
import commonUtils from '@/common/'
const base = '/api/cookcar-order'

const congorder = {
  // 代购列表
  getOrderList(params) {
    return DTaroAjax(`${base}/car/advanceMoneyApply/appList`, params)
  },
  getStocktaking(id) {
    return DTaroAjax(`${base}/car/stocktaking/getStocktaking?id=${id}`, {}, 'post')
  },
  // 新增
  addOrderMoney(params) {
    return DTaroAjax(`${base}/car/advanceMoneyApply/checkMoney`, params, 'POST')
  },
  // 新增详情
  getOrderDetail(params) {
    return DTaroAjax(`${base}/car/advanceMoneyApply/app/${params.id}`)
  },

  // 代购
  getOrderMoney() {
    return DTaroAjax(`${base}/car/advanceMoneyApply/checkMoney`)
  },
  //代购提升额度
  upappInfo() {
    return DTaroAjax(`${base}/car/amqa/appInfo`)
  },
  //提交额度申请
  submitAppinfo(params) {
    return DTaroAjax(`${base}/car/amqa/save`, params, 'POST')
  },
  //代购额度申请记录
  applyListRecord(params) {
    return DTaroAjax(`${base}/car/amqa/app/applyList`, params)
  },
  //代购申请详情
  getAdvanceDetail(params) {
    return DTaroAjax(`${base}/car/advanceMoneyApply/app/${params}`)
  },
  //代购申请资料/验车照片/合同凭证
  getAdvancePhoto(params) {
    return DTaroAjax(`${base}/car/advanceMoneyApply/fileList`, params)
  },
  //车商撤回审核
  getBackAdvance(params) {
    return DTaroAjax(`${base}/car/advanceMoneyApply/noApply?id=${params.id}`, {}, 'PUT')
  },
  //确认验车
  confirmCarPhoto(params) {
    return DTaroAjax(`${base}/car/advanceMoneyApply/dealerConfirm?id=${params.id}`, {}, 'PUT')
  },
  //确认合同
  confirmContractPhoto(params) {
    return DTaroAjax(`${base}/car/advanceMoneyApply/contractConfirm?id=${params.id}`, {}, 'PUT')
  },
  //获取物流信息
  getLogisticList(params) {
    return DTaroAjax(`${base}/car/advanceMoneyApply/getLogisList?refAmId=${params.id}`, {}, 'POST')
  },
  // 库融
  getOrderListData(params) {
    return DTaroAjax(`${base}/car/storageMoneyApply/appList`, params)
  },
  saveFormInfor(params) {
    return DTaroAjax(`${base}/car/storageMoneyApply/save`, params, 'POST')
  },
  // 获取表单信息
  getFormInfo(params) {
    return DTaroAjax(`${base}/car/storageMoneyApply/${params}`)
  },
  // 修改表单信息
  getAmendForm(params) {
    return DTaroAjax(`${base}/car/storageMoneyApply/${params.id}`, {}, 'PUT')
  },
  // 融资确定合同
  getRightInfo(params) {
    return DTaroAjax(`${base}/car/storageMoneyApply/contractConfirm?id=${params.id}`, {}, 'PUT')
  },
  // 取消库融订单
  getCancelInfo(params) {
    return DTaroAjax(`${base}/car/storageMoneyApply/noApply?id=${params.id}`, {}, 'PUT')
  },
  // 库融详情
  getStorageDeta(params) {
    return DTaroAjax(`${base}/`)
  },
  // 终止库融订单
  getStopOrder(params) {
    return DTaroAjax(`${base}/car/storageMoneyApply/stopApply?id=${params.id}`, {}, 'PUT')
  },
  //获取库融照片
  getFinancedPhoto(params) {
    return DTaroAjax(`${base}/car/storageMoneyApply/fileList`, params)
  },
  //确认验车照片
  confirmFinancedCar(params) {
    return DTaroAjax(`${base}/car/storageMoneyApply/dealerConfirm?id=${params.id}`, {}, 'PUT')
  },
  // 承运
  getOrderTransList(params) {
    return DTaroAjax(`${base}/trans/sellOrderTransList`, params)
  },
  // 承运确认退款列表
  pendingRefund2(params) {
    return DTaroAjax(`${base}/trans/pendingRefund`, params)
  },

  // 承运/托运详情
  getOrderTransDetail(params) {
    return DTaroAjax(`${base}/trans/orderTransDetail?id=${params.id}`, {})
  },
  //承运--上传验车照片
  uploadCarPhotos(params) {
    return DTaroAjax(`${base}/trans/uploadCarPhotos`, params, 'post')
  },
  //承运上传合同
  uploadPactPhoto(params) {
    return DTaroAjax(`${base}/trans/uploadPactPhotos`, params, 'post')
  },
  //查看合同照片
  checkPactPhoto(params) {
    return DTaroAjax(`${base}/trans/checkPactPhotos`, params)
  },
  // 卖家拒绝订单
  cancelMyList(params) {
    return DTaroAjax(`${base}/trans/refuse?id=${params.id}`)
  },
  // 卖家拒绝订单（跳龙存管）
  cancelMyList2(params) {
    return DTaroAjax(`${base}/trans/refuse2?id=${params.id}`)
  },
  // 卖家确认订单
  confirmMyList(params) {
    return DTaroAjax(`${base}/trans/accept?id=${params.id}`)
  },
  // 买家撤回订单
  getBackOrder(params) {
    return DTaroAjax(`${base}/trans/withdraw?id=${params.id}`)
  },
  // 买家撤回订单（新）
  getBackOrder2(params) {
    return DTaroAjax(`${base}/trans/applyForWithdrawOrder?id=${params.id}`)
  },

  // 买家确认订单
  confirmUserList(params) {
    return DTaroAjax(`${base}/trans/buyersConfirm?id=${params.id}`)
  },
  confirmUserList2(params) {
    return DTaroAjax(`${base}/trans/buyersConfirm2?id=${params.id}`)
  },
  // //拒绝接单
  // refuseOrderTrans(params) {
  //     return DTaroAjax(`${base}/trans/refuse`, params)
  // },
  // //接受订单
  // acceptOrderTrans(params) {
  //     return DTaroAjax(`${base}/trans/buyersConfirm`, params)
  // },

  // 托运订单
  getListTrans(params) {
    return DTaroAjax(`${base}/trans/buyOrderTransList`, params)
  },
  //托运--验车照片
  checkCarPhotos(params) {
    return DTaroAjax(`${base}/trans/checkCarPhotos`, params)
  },
  //托运--完成验车
  buyersConfirmCarPhotos(params) {
    return DTaroAjax(`${base}/trans/buyersConfirmCarPhotos`, params)
  },


  //发起托运订单（运输下单页面）
  getOrderTrans(params) {
    return DTaroAjax(`${base}/trans/orderTrans`, params)
  },
  //创建托运订单
  async addOrderTrans(params) {
    let para = params.orPrice
    let res = await http.keyInitInit()
    let paramsEnt = commonUtils.encryptResult(res, para)
    params.orPriceStr = paramsEnt
    return DTaroAjax(`${base}/trans/create`, params, 'POST')
  },




  // 每日盘库
  // getInvenList(params) {
  //     return DTaroAjax(`${base}/car/stocktaking/getCompanyStocktakings`, params, 'POST')
  // },

  // getInvenDetai(params) {
  //     return DTaroAjax(`${base}/car/stocktaking/getCompanyStocktakings?id=${params.id}`, {}, 'POST')
  // },

  // getInvenUpdate(params) {
  //     return DTaroAjax(`${base}/car/stocktaking/update`, params, 'PUT')
  // },

  //车辆交易订单
  getSaleOrder(params) {
    return DTaroAjax(`${base}/order/transCar/`, params)
  },

  getSaleDetail(params) {
    return DTaroAjax(`${base}/order/transCar/info/${params}`)
  },
  drawOrder(params) {
    return DTaroAjax(`${base}/order/transCar/applyForWithdrawOrder?orderId=${params.orderId}`, {}, 'POST')
  },
  drawOrder2(params) {
    return DTaroAjax(`${base}/order/transCar/withdrawOrder?orderId=${params.orderId}`, {}, 'POST')
  },
  /**
   * @description 判断是否退款  0：是 1：否
   */
  withdrawOrder2(orderId) {
    return DTaroAjax(`${base}/order/transCar/withdrawalOfConsent2?orderId=${orderId}`, {}, 'get')
  },
  // 售车拒绝订单
  refuseSaleOrder(params) {
    return DTaroAjax(`${base}/order/transCar/rejectOrder?orderId=${params.orderId}`, {}, 'POST')
  },
  // 售车拒绝订单
  refuseSaleOrder2(params) {
    return DTaroAjax(`${base}/order/transCar/rejectOrder2?orderId=${params.orderId}`, {}, 'POST')
  },
  uploadOrderFile(params) {
    return DTaroAjax(`${base}/order/transCar/uploadOrderFile`, params, 'POST')
  },
  queryOrderFile(params) {
    return DTaroAjax(`${base}/order/transCar/listOrderFile`, params, 'POST')
  },
  confirmOrder(params) {
    return DTaroAjax(`${base}/order/transCar/confirmOrder?orderId=${params.id}`, {}, 'POST')
  },
  confirmOrder2(params) {
    return DTaroAjax(`${base}/order/transCar/confirmOrder2?orderId=${params.id}`, {}, 'POST')
  },
  // 判断是否确认合同
  confirmOrder3(orderId) {
    return DTaroAjax(`${base}/order/transCar/confirmOrder3?orderId=${orderId}`, {}, 'get')
  },
  // 售车订单确认接单
  acceptSaleOrder(params) {
    return DTaroAjax(`${base}/order/transCar/acceptOrder?orderId=${params.orderId}`, {}, 'POST')
  },
  delayConfirmOrder(params) {
    return DTaroAjax(`${base}/order/transCar/delayConfirmOrder?orderId=${params.orderId}`, {}, 'POST')
  }
}

export default congorder
